//
//  PersonnelModel.m
//  YuTang
//
//  Created by 葛悦彣 on 2024/9/14.
//

#import "PersonnelModel.h"

@implementation PersonnelModel


-(NSAttributedString *)postNameStr{
    if(!_postNameStr){
        NSString * str = @"";
        for (NSString * postName in self.postName) {
            if(str.length == 0){
                str = [NSString stringWithFormat:@"岗位职责：%@",postName];
            } else {
                str = [NSString stringWithFormat:@"%@、%@",str,postName];
            }
        }
        _postNameStr = [DTKTool AttributedStringWithStr:str andNodeColor:KcolorHex(@"#787A79") andSeledColor:KcolorHex(@"#787A79") andNodeFont:kCFont(15) andFont:kFont(15) andPattenr:@"岗位职责："];
    }
    return _postNameStr;
}

- (CGFloat)postNameStrH{
    if(_postNameStrH == 0){
        _postNameStrH = [DTKTool textWithAttStr:self.postNameStr andSize:CGSizeMake(kwt(325), 1000)].height;
        if(_postNameStrH < kwt(15)){
            _postNameStrH = kwt(15);
        }
    }
    return _postNameStrH;
}
- (CGFloat)cellH{
    return kwt(142) + self.postNameStrH;
}

@end

@implementation PersonnelDetailsModel

-(NSString *)postNameStr{
    if(!_postNameStr){
        NSString * str = @"";
        for (NSString * postName in self.postName) {
            if(str.length > 0){
                str = [NSString stringWithFormat:@"%@、%@",str,postName];
            } else {
                str = [NSString stringWithFormat:@"%@",postName];
            }
        }
        _postNameStr = str;
    }
    
    return _postNameStr;
}
- (CGFloat)postNameViewH{
    if(_postNameViewH == 0){
        _postNameViewH = kwt(57) + [DTKTool textWithtitle:self.postNameStr andSize:CGSizeMake(kwt(330), 1000) andFout:kFont(15)].height;
    }
    return _postNameViewH;
}
@end
